<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                      "http://www.w3.org/TR/html4/transitional.dtd">
<html>
<head>
  <title>JCCKit User Guide: 4. JCCKit's PlotApplet</title>
  <meta name="author" content="Franz-Josef Elmer">
  <meta name="keywords" 
        content="Java, scientific plot software, open-source, SVG">
  <link rel="stylesheet" type="text/css" href="../styleSheet.css">
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td class="left-column" valign="top">
<!-- ======== Left column =========================== -->
<a href="../index.html"><img src="../images/logoSmall.png" border="0" 
alt="JCCKit logo" width="259" height="110"></a>
<p>
<ul><li><a href="../index.html">Home</a>
    <li><a href="../examples.html">Examples</a>
    <li><a href="http://sourceforge.net/project/showfiles.php?group_id=78114">Download</a>
    <li><a href="index.html">User Guide</a>
        <ol><li><a href="introduction.html">Introduction</a>
            <li><a href="usage.html">Usage as a library</a>
            <li><a href="config.html">Configuration Concept</a>
            <li><b>JCCKit's PlotApplet</b>
            <li><a href="extending.html">Extending JCCKit</a>
        </ol>
    <li><a href="../apidoc/index.html">API documentation</a>
    <li><a href="http://sourceforge.net/projects/jcckit">SourceForge 
        project page</a>
</ul>
<!-- ================================================ -->
</td>
<td class="right-column" valign="top">
<!-- ======== Right column =========================== -->
<h1>4. JCCKit's PlotApplet</h1>

The class <a href="../apidoc/jcckit/PlotApplet.html"><tt>PlotApplet</tt></a>
is an out-of-the-box applet to visualize static data on an HTML page. 
The layout is governed by applet parameters. The data are either specified
by applet parameters or loaded from a <tt>.properties</tt> file from the
Web server.
<p>
All static examples on the page <a href="../examples.html">Examples</a>
use this applet. Here is a minimum example:
<center>
<applet code="jcckit.PlotApplet" codebase="../examples" archive="jcckit.jar" width="400" height="200">
<param name="data/curves" value="curve">
<param name="data/curve/x" value="0 0.5 1">
<param name="data/curve/y" value="0.3 0.9 0.5">
</applet>
</center>
The corresponding HTML code reads:
<tt>
<pre>
&lt;applet code="jcckit.PlotApplet" codebase="../examples" archive="jcckit.jar" width="400" height="200">
&lt;param name="data/curves" value="curve">
&lt;param name="data/curve/x" value="0 0.5 1">
&lt;param name="data/curve/y" value="0.3 0.9 0.5">
&lt;/applet>
</pre>
</tt>
The default axes and layout has been used. Only one curve with three points
has been defined. 
<p>
The scaling of axis box and curves adapts automatically to the size of
the applet panel as shown in the following two variants of the same example 
where only the width and height attributes of the applet tag have been changed:
<center>
<table border="0" cellspacing="5" cellpading="0">
<tr>
<td>
<applet code="jcckit.PlotApplet" codebase="../examples" archive="jcckit.jar" width="300" height="150">
<param name="data/curves" value="curve">
<param name="data/curve/x" value="0 0.5 1">
<param name="data/curve/y" value="0.3 0.9 0.5">
</applet>
</td>
<td>
<applet code="jcckit.PlotApplet" codebase="../examples" archive="jcckit.jar" width="150" height="150">
<param name="data/curves" value="curve">
<param name="data/curve/x" value="0 0.5 1">
<param name="data/curve/y" value="0.3 0.9 0.5">
</applet>
</td>
</tr>
<tr><td align="center">width=300 height=150</td>
    <td align="center">width=150 height=150</td>
</tr>
</table>
</center>
But the font size does not scale! The default value is zero which will be
translated to a fixed size by the 
<a href="../apidoc/jcckit/renderer/GraphicsRenderer.html">
<tt>GraphicsRenderer</tt></a>.
<p>
For an appropriated font size which scales nicely the following 
<tt>param</tt> tags have been added:
<tt>
<pre>
&lt;param name="plot/coordinateSystem/xAxis/axisLabelAttributes/fontSize" value="0.03">
&lt;param name="plot/coordinateSystem/xAxis/ticLabelAttributes/fontSize" value="0.03">
&lt;param name="plot/coordinateSystem/yAxis/axisLabelAttributes/fontSize" value="0.03">
&lt;param name="plot/coordinateSystem/yAxis/ticLabelAttributes/fontSize" value="0.03">
&lt;param name="plot/legend/titleAttributes/fontSize" value="0.02">
</pre>
</tt>
<center>
<table border="0" cellspacing="5" cellpading="0">
<tr>
<td>
<applet code="jcckit.PlotApplet" codebase="../examples" archive="jcckit.jar" width="300" height="150">
<param name="data/curves" value="curve">
<param name="data/curve/x" value="0 0.5 1">
<param name="data/curve/y" value="0.3 0.9 0.5">
<param name="plot/coordinateSystem/xAxis/axisLabelAttributes/fontSize" value="0.03">
<param name="plot/coordinateSystem/xAxis/ticLabelAttributes/fontSize" value="0.03">
<param name="plot/coordinateSystem/yAxis/axisLabelAttributes/fontSize" value="0.03">
<param name="plot/coordinateSystem/yAxis/ticLabelAttributes/fontSize" value="0.03">
<param name="plot/legend/titleAttributes/fontSize" value="0.02">
</applet>
</td>
<td>
<applet code="jcckit.PlotApplet" codebase="../examples" archive="jcckit.jar" width="150" height="150">
<param name="data/curves" value="curve">
<param name="data/curve/x" value="0 0.5 1">
<param name="data/curve/y" value="0.3 0.9 0.5">
<param name="plot/coordinateSystem/xAxis/axisLabelAttributes/fontSize" value="0.03">
<param name="plot/coordinateSystem/xAxis/ticLabelAttributes/fontSize" value="0.03">
<param name="plot/coordinateSystem/yAxis/axisLabelAttributes/fontSize" value="0.03">
<param name="plot/coordinateSystem/yAxis/ticLabelAttributes/fontSize" value="0.03">
<param name="plot/legend/titleAttributes/fontSize" value="0.02">
</applet>
</td>
</tr>
</table>
</center>
<p> 
These font sizes are in device-independent coordinates.

<!-- ================================================ -->

</td>
</tr>
<tr class="footer">
<td colspan="2">
<center>
Java and all Java-based trademarks and logos are trademarks or registered 
trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
<br>
(C) 2003-2004 <a href="mailto:fjelmer@users.sourceforge.net?subject=JCCKit">
Franz-Josef Elmer</a>. All rights reserved. Last modified: 4/25/2003
</center>
</td>
</tr>
</table>
</body>
</html>
